/*
 * @Author: FanWeiHua
 * @Date: 2021-05-14 17:31:19
 * @LastEditTime: 2021-08-02 17:26:16
 * @Description: 开发时构建dll分包
 */
'use strict';
const path = require('path');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); // 每次构建前清理webpack配置的output目录，这样只会生成用到的文件
module.exports = {
  entry: {
    library: ['vue', 'vue-i18n', 'vue-router', 'vuex', 'lodash']
  },
  output: {
    path: path.join(__dirname, '../dll/library'),
    filename: '[name]_[contenthash].dll.js',
    library: '_dll_[name]'
  },
  plugins: [
    new CleanWebpackPlugin(),
    new webpack.DllPlugin({
      name: '_dll_[name]',
      path: path.join(__dirname, '../dll/library/[name].dll.manifest.json')
    })
  ],
  resolve: {
    extensions: ['.js', '.jsx']
  }
};
